<template>
    <el-row>
        <el-col :span="4" :offset="17">
            <el-input v-model="selectByjob.jobName" autocomplete="off" placeholder="请输入职位名称" size="medium"></el-input>
        </el-col>
        <el-col :span="3"  class="paddingLeft">
            <el-button type="primary" icon="el-icon-search" @click="selectBtn" size="medium">搜索</el-button>
        </el-col>
    </el-row>
</template>

<script>
    import {mapActions} from 'vuex'

    export default {
        name: "selectPermissionsBtn",
        data(){
            return{
                selectByjob:{   //查询权限的信息
                    jobName:'',
                 },
            }
        },
        methods:{
            ...mapActions(['selectPermissionsByObj']),
            //点击查询按钮
            selectBtn(){
                // console.log(this.selectByjob);
                if(this.selectByjob.jobName===''||this.selectByjob.jobName===undefined){
                    this.$message({
                        type: 'info',
                        message: '请输入职位名称'
                    });
                }else {
                    this.selectPermissionsByObj(this.selectByjob).then(res=>{
                        if (res.code===200){
                            this.$store.state.staffPermissionsStore.pages.currentPage=1;
                        }else {
                            this.$message({
                                type: 'error',
                                message: '未找到符合要求的数据！'
                            });
                        }
                    })
                }
            }
        }
    }
</script>

<style scoped>
    .paddingLeft{
        padding-left: 3.5%;
    }
</style>